//
//  ButtomTableViewCell.m
//  礼物说
//
//  Created by dllo on 16/4/27.
//  Copyright © 2016年 sunzhichao. All rights reserved.
//

#import "ButtomTableViewCell.h"

@interface ButtomTableViewCell ()

@property (nonatomic, retain) BaseImageView *imgView;
@property (nonatomic, retain) BaseLabel *label;

@end

@implementation ButtomTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)dealloc {
    [_label release];
    [_imgView release];
    [_model release];
    [super dealloc];
}

- (void)setModel:(GongLvXiangQingModel *)model {
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    _label.text = _model.title;
    [_imgView sd_setImageWithURL:[NSURL URLWithString:_model.cover_image_url] placeholderImage:PLACEHOLDER_IMAGE];
}

- (void)createCell{
    
    self.imgView = [[BaseImageView alloc] initWithFrame:CGRectMake(0, 0, kWIDTHS(375), kHEIGHTS(300))];
    [self.contentView addSubview:_imgView];
    [_imgView release];
    
    self.label = [[BaseLabel alloc] initWithFrame:CGRectMake(kWIDTHS(20), kHEIGHTS(300) - kHEIGHTS(100), kWIDTHS(375 - 20), kHEIGHTS(100))];
    [self.contentView addSubview:_label];
    [_label release];
    _label.font = [UIFont systemFontOfSize:20];
    _label.numberOfLines = 0;
    _label.textColor = [UIColor whiteColor];
    
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
